using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Runtime.Serialization;

namespace BeerScanatronClient.Entities
{
    [DataContract]
    [Table("Drinker")]
    public class Drinker
    {
        [DataMember]
        [Key]
        public int Id { get; private set; }

        [DataMember]
        [Timestamp]
        public Byte[] TimeStamp { get; private set; }

        [DataMember]
        [StringLength(50)]
        [Index("DrinkerBarCodeIndex", IsUnique = true)]
        [Required(AllowEmptyStrings = false, ErrorMessage = "Drinker Barcode cannnot be empty")]
        public string BarCode { get; set; }

        [DataMember]
        [Required(AllowEmptyStrings = false, ErrorMessage = "Drinker CanServe cannnot be empty")]
        public bool CanServe { get; set; }

        [DataMember]
        [StringLength(100)]
        [Required(AllowEmptyStrings = false, ErrorMessage = "Last Name cannnot be empty")]
        public string LastName { get; set; }

        [DataMember]
        [StringLength(100)]
        [Required(AllowEmptyStrings = false, ErrorMessage = "Last Name cannnot be empty")]
        public string FirstName { get; set; }

        public override string ToString()
        {
            return $"{FirstName}-{LastName}";
        }
    }
}